<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系统登录</title>
<link href="<?=css_path();?>style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="<?=public_js_path()?>jquery.js"></script>
<script language="javascript">
$(document).ready(function() {
	jQuery("#form1")[0].account.focus();
}); 
function sendLoginForm(){
	jQuery('#result').css('display','block');
	jQuery('#result').html('<IMG SRC="<?=public_img_path()?>ajaxloading.gif" WIDTH="16" HEIGHT="16" BORDER="0" ALT="" align="absmiddle"> 登录中～');
	var form = jQuery("#form1")[0];
	var url = '<?php echo site_url("login/check_login");?>';
	var data="account="+form.account.value+"&password="+form.password.value;
	jQuery.ajax({
		type:"post",
		url:url,
		data:data,
		success:function(str)
		{
			str = jQuery.parseJSON(str);
			if (str.status==1) {
				jQuery('#result').html('<span style="color:blue"><IMG SRC="<?=img_path()?>ok.gif" WIDTH="20" HEIGHT="20" BORDER="0" ALT="" align="absmiddle" > 登录成功！</span>');
				jQuery('#form1')[0].reset();
				window.location = '<?php echo site_url("index/main");?>';
			} else {
				jQuery('#result').html('<div style="fontweight:bold;color:red">'+str.info+'</div>');
				this.intval = window.setTimeout(function (){
				jQuery('#result').css('display','none');
				jQuery('#result').html('');},3000);
				jQuery('#result').html('<span style="color:blue"><IMG SRC="<?=public_img_path()?>ajaxloading.gif" WIDTH="20" HEIGHT="20" BORDER="0" ALT="" align="absmiddle" > '+str.info+'</span>');
			}
		}
	});
}
function keydown(e)
{
	var e = e || event;
	if (e.keyCode==13){
		sendLoginForm();
	}
}
</script>
</head>
<body>
<form method='post' id="form1" >
  <div class="tCenter hMargin">
    <table id="checkList" class="login shadow" cellpadding=0 cellspacing=0 >
      <tr>
        <td height="5" colspan="2" class="topTd" ></td>
      </tr>
      <tr class="row" >
        <th colspan="2" class="tCenter space" > 英雄传后台管理登录</th>
      </tr>
      <tr>
        <td height="5" colspan="2" class="topTd" ></td>
      </tr>
      <tr class="row" >
        <td colspan="2" class="tCenter"><div id="result" class="result none"></div></td>
      </tr>
      <tr class="row" >
        <td class="tRight" width="25%">帐 号：</td>
        <td><input type="text" class="medium bLeftRequire" check="Require" warning="请输入帐号" name="account"></td>
      </tr>
      <tr class="row">
        <td class="tRight">密 码：</TD>
        <td><input onKeyDown="keydown(event)" type="password" class="medium bLeftRequire" check="Require" warning="请输入密码" name="password"></TD>
      </tr>
      <tr class="row" >
        <td class="tCenter" align="justify" colspan="2"><input type="button" value="登 录" onclick="javascript:sendLoginForm()" class="submit small hMargin">
          <input type="reset" value="重 置" class="submit small">
        </td>
      </tr>
      <tr>
        <td height="5" colspan="2" class="bottomTd" ></td>
      </tr>
    </table>
  </div>
</form>
</body>
</html>
